<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>忘记密码</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "Microsoft YaHei", sans-serif;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background: linear-gradient(45deg, #6ac1c5, #bda5ff);

        }

        .container {
            width: 400px;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }

        .header {
            text-align: center;
            padding: 20px 0;
            background-color: #4285f4;
            color: white;
        }

        .header h1 {
            font-size: 24px;
            font-weight: normal;
        }

        .menu-bar {
            display: flex;
            border-bottom: 1px solid #e0e0e0;
        }

        .menu-item {
            flex: 1;
            text-align: center;
            padding: 15px 0;
            cursor: pointer;
            transition: all 0.3s;
            font-size: 16px;
        }

        .menu-item.active {
            color: #4285f4;
            border-bottom: 2px solid #4285f4;
            font-weight: bold;
        }

        .content {
            padding: 30px;
        }

        .content-section {
            display: none;
        }

        .content-section.active {
            display: block;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            color: #666;
        }

        .form-group input {
            width: 100%;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
        }

        .form-group .btn {
            width: 100%;
            padding: 12px;
            background-color: #4285f4;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s;
        }

        .form-group .btn:hover {
            background-color: #3367d6;
        }

        .verification-code {
            display: flex;
            margin-top: 10px;
        }

        .verification-code input {
            flex: 1;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px 0 0 4px;
        }


        .verification-code button {
            padding: 10px 15px;
            background-color: #f5f5f5;
            border: 1px solid #ddd;
            border-left: none;
            border-radius: 0 4px 4px 0;
            cursor: pointer;
        }

        .verification-code button.active {
            background-color: #4285f4;
            color: white;
            border: none;
        }

        .divider {
            display: flex;
            align-items: center;
            margin: 20px 0;
            color: #999;
            font-size: 14px;
        }

        .divider::before, .divider::after {
            content: "";
            flex: 1;
            height: 1px;
            background-color: #e0e0e0;
        }

        .divider::before {
            margin-right: 10px;
        }

        .divider::after {
            margin-left: 10px;
        }

        .login-link {
            text-align: center;
            margin-top: 20px;
            font-size: 14px;
            color: #666;
        }

        .login-link a {
            color: #4285f4;
            text-decoration: none;
        }

        .login-link a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="header">
        <h1>找回密码</h1>
    </div>

    <div class="menu-bar">
        <div class="menu-item active" data-target="phone">手机号</div>
        <div class="menu-item" data-target="email">邮箱</div>
    </div>

    <div class="content">
        <!-- 手机号找回密码 -->
        <div class="content-section active" id="phone">
            <div class="form-group">
                <label for="phone-number">手机号</label>
                <input type="tel" id="phone-number" placeholder="请输入注册时的手机号">
            </div>

            <div class="form-group">
                <label>验证码</label>
                <div class="verification-code">
                    <input type="text" placeholder="请输入验证码">
                    <button class="get-code">获取验证码</button>
                </div>
            </div>


            <div class="form-group">
                <label for="new-password">新密码</label>
                <input type="password" id="new-password" placeholder="请设置新密码">
            </div>

            <div class="form-group">
                <label for="confirm-password">确认密码</label>
                <input type="password" id="confirm-password" placeholder="请再次输入新密码">
            </div>

            <div class="form-group">
                <button class="btn">确认修改</button>
            </div>
        </div>

        <!-- 邮箱找回密码 -->
        <div class="content-section" id="email">
            <div class="form-group">
                <label for="email-address">邮箱</label>
                <input type="email" id="email-address" placeholder="请输入注册时的邮箱">
            </div>

            <div class="form-group">
                <label>验证码</label>
                <div class="verification-code">
                    <input type="text" placeholder="请输入验证码">
                    <button class="get-code">获取验证码</button>
                </div>
            </div>

            <div class="form-group">
                <label for="email-new-password">新密码</label>
                <input type="password" id="email-new-password" placeholder="请设置新密码">
            </div>

            <div class="form-group">
                <label for="email-confirm-password">确认密码</label>
                <input type="password" id="email-confirm-password" placeholder="请再次输入新密码">
            </div>

            <div class="form-group">
                <button class="btn">确认修改</button>
            </div>
        </div>

        <div class="divider">或</div>

        <div class="login-link">
            记住密码了？<a href="index.jsp">立即登录</a>
        </div>
    </div>
</div>

<script>
    // 菜单切换功能
    document.querySelectorAll('.menu-item').forEach(item => {
        item.addEventListener('click', function() {
            // 移除所有菜单项的active类
            document.querySelectorAll('.menu-item').forEach(el => {
                el.classList.remove('active');
            });

            // 为当前点击的菜单项添加active类
            this.classList.add('active');

            // 获取目标内容区域的ID
            const targetId = this.getAttribute('data-target');

            // 隐藏所有内容区域
            document.querySelectorAll('.content-section').forEach(section => {
                section.classList.remove('active');
            });

            // 显示目标内容区域
            document.getElementById(targetId).classList.add('active');
        });
    });

    // 验证码按钮点击事件
    document.querySelectorAll('.get-code').forEach(button => {
        button.addEventListener('click', function() {
            // Disable the button and start the countdown
            this.disabled = true;
            let count = 60;
            this.textContent = `${count}秒后重新获取`;

            const timer = setInterval(() => {
                count--;
                this.textContent = `${count}秒后重新获取`;

                if (count <= 0) {
                    clearInterval(timer);
                    this.textContent = '获取验证码';
                    this.disabled = false; // Re-enable the button
                }
            }, 1000);
        });
    });
</script>
</body>
</html>